import * as actionTypes from "./actionTypes";
import axios from 'axios';
import "../../../api/mock.js";
export const changeList = (result) => ( {
        type: actionTypes.getAllIndex,
        ulDate: result.ulDate,
        textData: result.textData,
        homeRightUlli: result.homeRightUlli,
     
})
export const setMoreList = (result) => ( {
    type: actionTypes.setMoreList,
    data:result
})

export const getList = () => {
    return (dispatch)=>{
        axios.post("/index.json").then(res => {
            console.log("*****",res)
            if (res.status === 200) {
                var result = res.data.data ;
                console.log("^^^^^^",result)
                dispatch(changeList(result))
            }
        })
    }
}

export const getMoreList=()=>{
    console.log("#######")
    return (dispatch)=>{
        axios.post("/homeList.json").then(res => {
            console.log("6666666",res)
            if (res.status === 200) {
                var result = res.data.data ;
                
                dispatch(setMoreList(result))
            }
        })
    }
}
